<template>
  <SplitLayout>
    <div class="con-content">
      <!-- <p>下载附件</p> -->
      <div class="downLoadBox">
        <img src="./img/logo.png" alt="" />
        <p style="font-size: 20px;">{{ fileText }}</p>
        <downLoadComponents ref="downLoadComponentsId" style="display: inline-block">
          <a-button type="primary" @click="onExportDowm">下载</a-button>
        </downLoadComponents>
      </div>
      <div class="txtBox">
        <p class="title">工具要求</p>
        <p>1、本工具提供网址的检测服务，需要在联网的电脑上使用</p>
        <p class="title">使用说明</p>
        <p>1、第一步，把要检测的URL粘贴到domains.txt</p>
        <p>2、第二步，鼠标点击domain2ip.exe</p>
        <p>3、第三步，等待任务执行完成（文件夹下面会输出output.csv文件）</p>
        <p class="title">文件说明</p>
        <p>1、output.csv文件中原URL为需要查询的URL，状态码为200的就是可以正常访问的URL</p>
      </div>
    </div>
  </SplitLayout>
</template>
<script>
import { SplitLayout } from '@/components/zxd/layouts'
import downLoadComponents from '@/components/zxd/downLoad'
import { toolDownload } from '@/api/modules/feedbackManagement.js'
export default {
  components: {
    SplitLayout,
    downLoadComponents
  },
  data() {
    return {
      fileText: 'domain2ip'
      // downUrl: 'http://172.16.26.45:8090/api/sys/common/static/static/newZipFile.zip',
    }
  },
  methods: {
    onExportDowm() {
      toolDownload()
        .then(res => {
          if (res.success) {
            let downUrl = process.env.VUE_APP_API_BASE_URL + '/sys/common/static' + res.result
            console.log(downUrl)
            this.$refs.downLoadComponentsId.downloadFile(downUrl, this.fileText + '.zip')
          } else {
            this.$message.warning(res.message ? res.message : '请求失败！')
          }
        })
        .catch(e => {
          this.$message.warn('请求失败！')
        })
    }
  }
}
</script>
<style scoped lang="less">
.downLoadBox {
  width: 80px;
  margin: 50px auto;
  img {
    width: 100%;
  }
}
/deep/ .ant-btn-primary {
  width: 100px;
}
.txtBox {
  .title {
    font-size: 18px;
    font-weight: bold;
  }
  p {
    font-size: 16px;
  }
}
</style>
